﻿var service = service || {};
service.xhr = function () {
    return {
        call: function (method, url, requestbody) {
            var request = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
            request.open(method, url, false);
            request.send(requestbody);
            return request.responseText;
        },
        get: function (url) {
            return service.xhr.call('GET', url, null);
        },
        put: function (url, requestbody) {
            return service.xhr.call('GET', url, requestbody);
        },
        post: function (url, requestbody) {
            return service.xhr.call('GET', url, requestbody);
        },
        del: function (url) {
            return service.xhr.call('GET', url, null);
        }
    }
} ();